:root {
  /* Light theme only -- the app has no dark theme. */
  color-scheme: light;
  /* St. Bernadette USA design system -- token names match the "St. Bernadette
     USA" design-system artifact (project/tokens.json). Use these names in new
     rules; the legacy aliases at the bottom of this block only exist so older
     inline styles or third-party snippets keep working. */

  /* Color: brand */
  --primary: #007a9e;          /* buttons, links, active item, big numbers */
  --primary-strong: #00607c;   /* hover; text on primary-soft */
  --primary-soft: #e5f2f6;     /* active item / soft badge background */
  --primary-soft-hover: #d6ebf1;
  --ink: #1d333c;              /* text, icons, dark featured surface */
  --ink-muted: #888888;        /* secondary text only (3.5:1 on white) */
  --logo-red: #cc1416;         /* urgent / error */
  --star-gold: #e0ab12;        /* star markers, highlights -- never text on white */
  --star-gold-light: #f0c94a;  /* gold text on the dark ink surface */
  --logo-navy: #26295c;        /* logo artwork only */
  --logo-grey: #9d9d9b;        /* logo artwork only */

  /* Color: surfaces and lines */
  --ground: #f4f7f8;           /* page background, search fill */
  --surface: #ffffff;          /* cards, panels, header, sidebar */
  --border: #e3e9eb;
  --border-strong: #c9d6da;
  --ink-inverse-muted: #d3dde0; /* secondary text on the ink surface */
  --overlay: rgba(29, 51, 60, 0.6);

  /* Color: states (not in the brand palette; derived for UI feedback) */
  --success: #2a7a3d;
  --success-soft: #e6f2e9;
  --warn-soft: #fdf5dc;
  --warn-ink: #6e5304;
  --danger-soft: #fbe7e7;
  --danger-ink: #a50f12;
  --attention: #d9660b;        /* orphaned Library files */

  /* Type */
  --font-display: "Playfair Display SC", Georgia, serif;
  --font-sans: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing (4px steps) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  /* Layout */
  --header-h: 72px;
  --page-max: 1320px;

  /* Component tokens */
  --avatar-bg: var(--primary-soft);

  /* Legacy aliases -- do not use in new code. */
  --bg: var(--ground);
  --panel: var(--surface);
  --muted: var(--ink-muted);
  --navy: var(--primary);
  --accent: var(--primary);
  --red: var(--logo-red);
  --gold: var(--star-gold);
  --orange: var(--attention);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  background: var(--ground);
  color: var(--ink);
}

.top-header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ai-usage-tiles {
  display: flex;
  gap: var(--space-6);
}

.ai-usage-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.ai-usage-tile-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.ai-usage-tile-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.side-nav {
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 60px;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6) 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.15s ease;
}

body.nav-collapsed .side-nav { width: var(--sidebar-collapsed-w); }
body.nav-no-transition .side-nav { transition: none; }

/* Sidebar collapse/expand toggle, adapted from /platform's
   #nav-collapse-btn -- kept fully inside the sidebar's own box (not
   overlapping the border like the source) since .side-nav clips
   overflow-x for its scrollable link list. */
#nav-collapse-btn {
  position: absolute;
  top: 1.25rem;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  z-index: 5;
}

#nav-collapse-btn:hover { color: var(--primary); border-color: var(--primary); }

body.nav-collapsed #nav-collapse-icon { transform: rotate(180deg); }

/* Collapse/expand-all toggle, adapted from platform's #pm-toggle-collapse-all. */
.nav-toolbar { padding: 0 var(--space-5) 0.65rem; }
#nav-collapse-all-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.4rem var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
}
#nav-collapse-all-btn:hover { color: var(--primary); border-color: var(--primary); }
body.nav-collapsed .nav-toolbar { display: none; }

.nav-group-label {
  padding: 0.65rem var(--space-5);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-group-label.active { color: var(--primary); }

/* Per-group collapse arrow (platform's .tree-toggle) -- rotated -90deg via
   inline style in app.js's setGroupCollapsed(), not a CSS class, so the
   transform survives independent of the .collapsed class living on the
   ancestor .nav-group rather than this element. */
.tree-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.7rem;
  width: 0.9em;
}
.tree-toggle i { transition: transform 0.12s ease; }

/* Matches .tree-toggle's box exactly (same explicit font-size, not just the
   same em multiplier) so its width lines up pixel-for-pixel regardless of
   the font-size its .nav-link parent happens to set. */
.tree-toggle-spacer {
  font-size: 0.7rem;
  width: 0.9em;
  flex-shrink: 0;
}
body.nav-collapsed .tree-toggle-spacer { display: none; }

/* Matches .nav-group-label's typography (size, weight, color, caps) so a
   top-level item like Forms reads as a section-level entry instead of a
   larger, darker plain .nav-link. Qualified with .nav-link so it outranks
   .nav-link's own `color` below regardless of source order. */
.nav-link.nav-top-item {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nav-group.collapsed .nav-group-body { display: none; }

.nav-link {
  padding: 0.65rem var(--space-5);
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-link-icon { width: 1.1em; flex-shrink: 0; text-align: center; }

.nav-sublink {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  padding-left: 3.25rem;
  font-size: 0.93rem;
}

.nav-link:hover { background: var(--ground); }

/* Pin/unpin toggle (platform's .pin-toggle) -- appended by app.js as the
   last child of each pinnable .nav-link, riding its existing flexbox row
   (pushed to the far right via margin-left:auto) rather than absolutely
   positioned, since it has no positioned ancestor of its own to anchor to. */
.pin-toggle {
  margin-left: auto;
  color: var(--border);
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  padding: 0.2rem;
}
.nav-link:hover .pin-toggle,
.pin-toggle:hover,
.pin-toggle.pinned { opacity: 1; }
.pin-toggle.pinned { color: var(--star-gold); }
body.nav-collapsed .pin-toggle { display: none; }

#nav-group-pinned .nav-group-label { cursor: default; }
#nav-group-pinned .tree-toggle { cursor: pointer; }

.nav-link.active {
  border-left-color: var(--logo-red);
  font-weight: 600;
  background: var(--ground);
  color: var(--primary);
}

.logout-link { color: var(--ink-muted); }

/* Collapsed: icon rail only. Sub-items and group-label text hide; clicking
   a group label re-expands (see app.js) since there's nowhere else to
   reach a sub-item's target without expanding first. */
body.nav-collapsed .nav-label { display: none; }
body.nav-collapsed .nav-link,
body.nav-collapsed .nav-group-label {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
body.nav-collapsed .nav-sublink { display: none; }
body.nav-collapsed .nav-group-label { cursor: pointer; }
body.nav-collapsed .tree-toggle { display: none; }

.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-8);
  max-width: 960px;
}

.main-content h1 { margin-top: 0; }

/* ---- Sign-in page (login.php) --------------------------------------------
   Left: slideshow of Art Studio images (login.js). Right: the form, on the
   pale blue of the design system. */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 37.5%) minmax(0, 1fr);
  background: var(--primary-soft);
  color: var(--ink);
  font-family: var(--font-sans);
}

.login-slides {
  position: relative;
  overflow: hidden;
  background: #f1ece2;
}
.login-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.login-slide:not([src]) { visibility: hidden; }
.login-slide.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .login-slide { transition: none; }
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem var(--space-6);
}
.login-form {
  width: 100%;
  max-width: 545px;
  display: flex;
  flex-direction: column;
}
.login-logo {
  display: block;
  width: 280px;
  max-width: 75%;
  height: auto;
  margin: 0 0 2.25rem;
}
.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.65rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.login-sub {
  margin: 0.3rem 0 2.1rem 0.15rem;
  font-size: 1.05rem;
  color: var(--ink);
}
.login-error {
  margin: 0 0 var(--space-4);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--logo-red);
  font-size: 0.9rem;
}

.login-field { position: relative; margin-bottom: 0.9rem; }
.login-form .login-field input {
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: 1px solid #c3cbd3;
  border-radius: 3px 3px 0 0;
  background: #f1f3f7;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.login-form .login-field input::placeholder { color: #7c858c; }
.login-form .login-field input:focus { outline: none; border-bottom: 2px solid var(--primary); background: #fff; }
.login-form .login-field input:focus-visible { box-shadow: 0 0 0 2px rgba(0, 122, 158, 0.25); }
.login-form .login-field.has-toggle input { padding-right: 3.25rem; }
.login-eye {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #6b7479;
  cursor: pointer;
}
.login-eye:hover { color: var(--ink); background: rgba(29, 51, 60, 0.06); }
.login-eye .eye-closed { display: none; }
.login-eye[aria-pressed="true"] .eye-open { display: none; }
.login-eye[aria-pressed="true"] .eye-closed { display: block; }
.login-hint { margin: -0.5rem 0 1.1rem; font-size: 0.78rem; color: var(--ink-muted); }

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  align-self: flex-start;
  margin-bottom: var(--space-4);
  font-size: 0.95rem;
  cursor: pointer;
}
.login-remember input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }

.login-submit {
  height: 42px;
  border: 0;
  border-radius: 2px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}
.login-submit:hover { background: var(--primary-strong); }
.login-submit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 800px) {
  .login-body { grid-template-columns: 1fr; }
  .login-slides { display: none; }
  .login-main { align-items: flex-start; padding: var(--space-10) var(--space-4); }
  .login-title { font-size: 2.1rem; }
}

/* Same name the platform's own table markup uses for a centred cell, so a
   column copied from there keeps working. */
.txC { text-align: center; }

/* The prayer request itself in the detail modal: petitioners type real line
   breaks, and they carry meaning (a list of names, one per line), so keep
   them instead of collapsing the text into one paragraph. */
.pr-detail-text { white-space: pre-wrap; }

/* Void toggle, in the list column and in the detail modal alike: off (void 0)
   reads as switched off -- greyed and low contrast -- while on (void 1) keeps
   the brand colour, the way a real switch looks. Still fully clickable in
   both states; this is appearance only. */
.pr-void-toggle .fa-toggle-off,
#pr-modal-void .fa-toggle-off { color: var(--ink-muted); opacity: 0.55; }
.pr-void-toggle .fa-toggle-on,
#pr-modal-void .fa-toggle-on { color: var(--primary); }

.status-ok { color: var(--success); }
.status-fail { color: var(--logo-red); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

textarea, select, input[type=text], input[type=file], input[type=password], input[type=number] {
  font-family: inherit;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 360px;
}

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
}

/* Two fields sharing one line inside a .stacked-form (e.g. Home Widget's
   publish/cutoff dates) -- each label keeps its own column layout, just
   side by side instead of full-width. */
.form-row {
  display: flex;
  gap: var(--space-3);
}
.form-row > label { flex: 1; min-width: 0; }

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th, .users-table td {
  text-align: left;
  padding: var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

/* Deliberately not display:flex -- that overrides the <td>'s table-cell
   display and breaks its participation in the row's shared height/border
   alignment. Inline elements + margin spacing keeps it a normal cell. */
.users-table-actions { white-space: nowrap; }
.users-table-actions > * { vertical-align: middle; }
.users-table-actions > * + * { margin-left: var(--space-3); }
.users-table-actions a { color: var(--primary); }

.inline-form { display: inline; margin: 0; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
/* Destructive text/icon actions keep the urgent red (logo-red = urgent/error). */
.link-button[class*="delete-"],
.link-button[class*="remove-"] { color: var(--logo-red); }

.link-button.icon-btn {
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem;
}
.link-button.icon-btn:hover { opacity: 0.75; }

.page-intro { color: var(--ink-muted); max-width: 640px; }

.doc-card h3 { margin-top: 0; margin-bottom: var(--space-1); }
.doc-meta { color: var(--ink-muted); font-size: 0.85rem; margin: 0 0 0.6rem; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
}

.image-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.image-cell img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--ground);
}

.image-cell .no-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  background: var(--ground);
}

.image-cell-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

/* Home Widget item page (manager/public/assets/news-widget-item.js): an
   image whose eye/eye-slash toggle has hidden it from the public widget --
   dimmed so it's visually obvious at a glance which images are actually
   live, without needing to read each button's title. */
.image-cell.nw-image-hidden img { opacity: 0.35; }

.style-guide-card { display: flex; flex-direction: column; gap: var(--space-3); }
.style-guide-card label { display: flex; flex-direction: column; gap: 0.3rem; }
.style-guide-card h3 { margin-bottom: 0.3rem; }

.style-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.style-guide-header h2 { margin: 0; display: flex; align-items: center; gap: var(--space-2); }

.lock-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--star-gold);
  color: var(--ink);
  padding: 0.15rem var(--space-2);
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.style-guide-images { margin-bottom: var(--space-2); }
.style-guide-images .image-cell { padding: 0.4rem; }

.ai-function-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.ai-function-header h2 { margin: 0; }

.ai-function-controls {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.ai-function-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}
.fn-status { font-size: 0.85rem; }

.inline-upload-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: var(--space-2);
}
.inline-upload-form input[type=text] { flex: 1; }

/* Shared by every module's list page: search box + "Add new" button above
   a .users-table. See manager/CLAUDE.md for the list/record-page convention. */
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.list-toolbar input[type=text] { flex: 1; max-width: 420px; }

.library-no-owner-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  white-space: nowrap;
  cursor: pointer;
}

.danger-zone {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.learnings-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.learnings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.muted-note { color: var(--ink-muted); font-size: 0.9rem; }

.reference-picker { display: flex; gap: 0.6rem; }
.reference-picker select { flex: 1; }

.selected-references-list {
  list-style: none;
  margin: -0.5rem 0 var(--space-2);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.selected-references-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.custom-size-fields {
  display: flex;
  gap: var(--space-4);
  margin-top: -0.4rem;
}
.custom-size-fields[hidden] { display: none; }

/* partials/breadcrumbs.php -- rendered at the top of <main>, above the
   page's <h1>. */
.breadcrumbs {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
}
.breadcrumbs a { color: var(--ink-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumbs .breadcrumb-sep { margin: 0 0.45rem; }
.breadcrumbs .breadcrumb-current { color: var(--ink); }

/* pages/forms.php hub -- one section per public form, each a grid of
   link-buttons. Same shape as /platform's cm.php?op=settings_settings-main
   (labeled section above a button grid), adapted to this app's tokens. */
/* Sections are spaced by .as-page's column gap. */
.forms-hub-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 0.85rem;
}
.forms-hub-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}
.forms-hub-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.forms-hub-btn i { width: 18px; text-align: center; color: var(--primary); }
.forms-hub-btn:hover { background: var(--primary); color: #fff; }
.forms-hub-btn:hover i { color: #fff; }
/* The grid holds both links and real <button>s (the action buttons, which
   post instead of navigating); these are the defaults a button doesn't
   inherit on its own. */
button.forms-hub-btn {
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
button.forms-hub-btn:disabled { opacity: 0.5; cursor: default; }
button.forms-hub-btn:disabled:hover { background: var(--surface); color: var(--ink); }
button.forms-hub-btn:disabled:hover i { color: var(--primary); }

.slide-nav-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-2);
}
.slide-nav-header .icon-btn:disabled { opacity: 0.3; cursor: default; }
#slide-label { margin: 0; }

.illustration-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: var(--space-3);
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.illustration-nav .icon-btn:disabled { opacity: 0.3; cursor: default; }

.asset-cell { position: relative; }
.asset-cell-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-5);
  font-size: 1rem;
}

/* Reset browser <button> chrome so .asset-id-btn (a library-card-id
   rendered as a button, for click-to-copy) picks up the exact same
   typography as every other library-card-id -- see .library-card-id below. */
.asset-id-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.asset-id-btn:hover { color: var(--primary); }

/* Shared by every image display in the app -- see app.js:imageWithZoomHtml().
   A wrap around one <img> plus a top-right hover overlay with one or more
   small action buttons (zoom to full size, download). */
.asset-image-wrap { position: relative; }
.image-hover-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.asset-image-wrap:hover .image-hover-actions,
.image-hover-actions:focus-within { opacity: 1; }

.image-hover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 51, 60, 0.55);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  width: 1.9rem;
  height: 1.9rem;
  cursor: pointer;
  text-decoration: none;
}
.image-hover-btn:hover, .image-hover-btn:focus-visible { background: rgba(29, 51, 60, 0.8); }

/* For a single full-size "hero" image on a detail page (not a grid cell,
   which already sizes its <img> via .image-cell img). */
.detail-image-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

.image-zoom-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  height: 100%;
  min-height: 0;
}
.image-zoom-modal-body img {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  flex-shrink: 1;
  min-height: 0;
}
/* Takes up most of the window (not just shrink-wrapped to the image) so
   there's always room for the image plus the tag editor below it without
   the dialog itself having to scroll. */
.modal-dialog.image-zoom-modal {
  width: 92vw;
  max-width: 92vw;
  height: 90vh;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.image-zoom-modal .image-tags-editor {
  width: 100%;
  max-width: 32rem;
  flex-shrink: 0;
  overflow-y: auto;
}

.failed-scenes-card { border-color: var(--logo-red); }
.failed-scenes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.failed-scenes-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
}
.failed-scene-desc { flex: 1; font-size: 0.9rem; }
.failed-scene-status { flex-basis: 100%; font-size: 0.85rem; }

.failure-reasons {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--logo-red);
}
.retry-scene-btn { flex-shrink: 0; }

/* Generic modal (app.js openModal) */
body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-6);
}

.modal-dialog {
  position: relative;
  background: var(--surface);
  border-radius: 10px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: var(--space-6);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 0.4rem;
  line-height: 1;
}
.modal-close-btn:hover { color: var(--ink); }

/* Change-request modal: image on one side, form on the other */
.change-request-modal-body {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.modal-image-pane { flex: 1 1 360px; min-width: 280px; }
.modal-form-pane { flex: 1 1 320px; min-width: 280px; }
.modal-form-pane h2 { margin-top: 0; font-size: 1.1rem; }

.modal-preview-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
}
.modal-preview-img[hidden] { display: none; }

.change-request-modal-body fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}
.change-request-modal-body legend { font-size: 0.78rem; color: var(--ink-muted); padding: 0 0.3rem; }
.change-request-modal-body fieldset label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  margin: var(--space-1) 0;
  font-size: 0.88rem;
}
.change-request-modal-body textarea { width: 100%; margin-bottom: var(--space-3); }

.entire-area-fields[hidden], .portion-area-fields[hidden] { display: none; }

.rectangle-editor-container[hidden] { display: none; }
.rectangle-editor-container { max-width: 100%; }
.rectangle-editor-canvas {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: crosshair;
  display: block;
}

.region-instructions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.region-instructions-list label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}

/* Gold border marks the one AI-assisted action on the record page. */
.btn.compact-learnings-btn { align-self: flex-start; margin-top: var(--space-2); border-color: var(--star-gold); }

.compact-modal-body { width: min(80vw, 900px); }
.compact-modal-body h2 { margin-top: 0; }
.compact-modal-columns {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-4);
}
.compact-modal-columns[hidden] { display: none; }
.compact-modal-columns > div { flex: 1; min-width: 0; }
.compact-modal-columns h3 { font-size: 0.9rem; margin-bottom: 0.4rem; }
.compact-modal-columns textarea { width: 100%; font-size: 0.85rem; }
.current-prompt-view { background: var(--ground); color: var(--ink-muted); }

.compact-modal-actions { margin-top: var(--space-4); }
.compact-modal-actions[hidden] { display: none; }
.compact-modal-status[hidden] { display: none; }

.projects-table td, .projects-table th { vertical-align: middle; }
.projects-table .users-table-actions a { color: var(--primary); font-size: 1rem; }

.modal-dialog.new-project-modal { max-width: 480px; }
.modal-dialog.add-project-modal { max-width: 920px; }
.modal-dialog.style-changes-modal { max-width: 560px; }
.style-changes-modal-body h2 { margin-top: 0; }
.new-project-modal-body h2 { margin-top: 0; }
.new-project-form { max-width: none; }
.new-project-columns {
  display: flex;
  gap: var(--space-8);
  align-items: flex-start;
}
.new-project-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.new-project-col textarea { flex: 1; min-height: 9rem; }

/* Request Changes modal (asset-project.php): one or more targeted
   corrections built up before a single submit processes them all. */
.learning-entries { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0; }
.learning-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.learning-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.learning-form textarea { width: 100%; }
.learning-form-committed {
  background: var(--ground);
  padding: 0.6rem var(--space-3);
  gap: 0.2rem;
}
.learning-form-committed .learning-committed-target { font-size: 0.8rem; color: var(--ink-muted); }
.learning-form-committed .learning-committed-text { font-size: 0.9rem; }
.request-changes-submit-row { margin-top: var(--space-2); }

/* "Add new illustration" wizard's review step: one editable prompt per
   planned scene, shown before any image is actually generated. */
.modal-dialog.scene-review-modal {
  width: min(95vw, 1200px);
  max-width: min(95vw, 1200px);
  height: 90vh;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
}
.scene-review-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}
.scene-review-body .scene-review-list { flex: 1; min-height: 0; overflow-y: auto; }
.scene-review-list { display: flex; flex-direction: column; gap: var(--space-4); margin: var(--space-3) 0; }
.scene-review-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.scene-review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.scene-review-header h3 { margin: 0; font-size: 1rem; }
.scene-review-prompt {
  width: 100%;
  font-size: 1.05rem;
  line-height: 1.55;
  padding: 0.6rem;
}

.clear-regions-btn { align-self: flex-start; }
.custom-size-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  flex: 1;
}

/* The Library page uses more of the window than the site's usual 960px
   main-content cap so 5 columns have room -- scoped to this page only via
   the .library-page modifier on <main>, not a global change. */
.library-page { max-width: 1400px; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1300px) { .library-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1000px) { .library-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .library-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px)  { .library-grid { grid-template-columns: 1fr; } }

.library-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

/* No rtm_document_links row points at this file anymore (see
   remove_document_link() in lib/library.php) -- it's safe to delete but
   nothing does so automatically, so flag it for a human to decide. */
.library-card-no-owner { border-color: var(--attention); border-width: 2px; }

.library-card-delete-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  background: rgba(29, 51, 60, 0.55);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.library-card-no-owner:hover .library-card-delete-btn,
.library-card-delete-btn:focus-visible { opacity: 1; }
.library-card-delete-btn:hover { background: var(--logo-red); }

/* Fixed-size square, same for every card regardless of the file's own
   aspect ratio -- the image is scaled to fit inside via object-fit:
   contain rather than cropped, matching every other file type's icon box. */
.library-card-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--ground);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.library-card-thumb .asset-image-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.library-card-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  background: none;
}
.library-file-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--ink-muted);
}

.library-card-id, .library-card-filename, .library-card-dims, .library-card-size {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.library-card-id { font-family: monospace; word-break: break-all; }
.library-card-filename { color: var(--ink); font-weight: 600; overflow-wrap: break-word; }
.library-card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.1rem; }

/* Which AI planned the prompt / rendered the current image, shown above
   the thumbnail -- see asset-illustration.js's renderAssetCell(). */
.library-card-models {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.68rem;
  color: var(--ink-muted);
}
.library-card-models span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-card-models i { flex-shrink: 0; opacity: 0.7; }

.asset-prompt-modal-body { display: flex; flex-direction: column; gap: var(--space-3); }
.asset-prompt-modal-body label { display: flex; flex-direction: column; gap: 0.3rem; }
.asset-prompt-modal-body textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.publish-log-view {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin: 0;
  max-height: 70vh;
  overflow: auto;
}

.library-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.library-pagination-controls { display: flex; align-items: center; gap: var(--space-2); }
.library-page-size-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--ink-muted); }

/* Home Widget list (pages/news-widget.php): one-line caption with ellipsis,
   and an always-visible pin star (unlike .pin-toggle, the sidebar's
   hover-only quick-pin icon -- this is a persistent "featured" flag, so it
   needs to read at a glance without hovering). */
.news-widget-caption-cell {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nw-star-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--ink-muted);
}
.nw-star-btn.pinned { color: var(--star-gold); }
.nw-star-btn:disabled { cursor: default; opacity: 0.6; }

.char-countdown { font-size: 0.8rem; color: var(--ink-muted); }

/* Home Widget's image crop tool (pages/news-widget-item.php), same
   Cropper.js-based flow as the platform newsletter template's image
   upload. */
.nw-crop-modal { width: 640px; max-width: 90vw; }
.nw-crop-container {
  width: 100%;
  max-height: 60vh;
  overflow: hidden;
  background: var(--ground);
  margin-bottom: var(--space-3);
}
.nw-crop-container img { display: block; max-width: 100%; }
.nw-crop-resmode {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
}
.nw-crop-actions { margin-bottom: var(--space-2); }

/* "Choose from Library" picker modal (openLibraryPicker() in app.js). */
.library-picker-modal { width: 640px; max-width: 90vw; }
.library-picker-body h2 { margin-top: 0; }
.library-picker-search { width: 100%; margin-bottom: var(--space-3); }
.library-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
  max-height: 50vh;
  overflow-y: auto;
}
.library-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}
.library-picker-item:hover { border-color: var(--primary); background: var(--ground); }
.library-picker-item img { width: 100%; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
.library-picker-item i { font-size: 1.8rem; color: var(--ink-muted); height: 64px; display: flex; align-items: center; justify-content: center; }
.library-picker-item-name {
  font-size: 0.72rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* Request Relics detail modal (openRequestRelicDetail() in request-relics.js) --
   same field-list shape as /platform's library/php/forms/view.php this mirrors.
   Unlike the generic .modal-dialog (a single box that scrolls as a whole),
   this one splits into a non-scrolling header (X button + Prev/Next, both
   truly outside the scroll container, not just visually pinned via
   position:sticky/absolute within it) and a separate scrollable body --
   every level from the dialog down to .rr-detail-scroll needs both a flex
   role and min-height:0 for the nested-scroll-area trick to work. */
.modal-dialog.rr-detail-modal {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.rr-detail-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.rr-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-6);
}
.rr-detail-modal-body > p { padding: var(--space-6); margin: 0; } /* loading/error states */
.rr-detail-modal-body h2 { margin-top: 0; }
.rr-detail-section {
  margin: var(--space-5) 0 var(--space-2);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rr-detail-field { margin: 0 0 0.6rem; }
.rr-detail-field dt { font-size: 0.8rem; color: var(--ink-muted); }
.rr-detail-field dd { margin: 0.1rem 0 0; white-space: pre-wrap; }
.rr-relationship-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-relationship-cell.rr-clergy { color: var(--primary); }
.rr-batch-count-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.rr-batch-count-row label { font-weight: 600; }
.rr-batch-count-row input[type="number"] { width: 5em; }
.rr-batch-modal-body #rr-batch-list { margin: var(--space-3) 0; }
.rr-batch-modal-body #rr-batch-actions { margin: var(--space-4) 0; }
.rr-batch-busy {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-muted);
}
.rr-batch-busy .fa-spinner { color: var(--primary); }
.rr-batch-result { margin-bottom: var(--space-3); }
.rr-batch-result h4 { margin: 0 0 var(--space-2); }
.rr-batch-result p { margin: var(--space-1) 0; }
.rr-email-preview {
  white-space: pre-wrap;
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-top: var(--space-2);
}
/* The non-scrolling header itself (see .rr-detail-modal-body above) -- a
   real flex sibling of .rr-detail-scroll, not part of its scroll container
   at all. Wide right padding keeps "Next" clear of the dialog's X button. */
.rr-detail-nav {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 3rem var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.rr-detail-nav button[disabled] { opacity: 0.4; cursor: default; }
.rr-nowrap { white-space: nowrap; }
.rr-date-col { width: 5.5rem; }
.rr-message-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
  margin-right: 0.4rem;
  vertical-align: middle;
}
.rr-retry-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 0;
}

/* "Choose from Library" affordances used everywhere a file input offers
   picking an existing file instead of uploading a new one. */
.library-pick-row { margin: 0.4rem 0; }
.library-pick-btn { white-space: nowrap; }
.library-picked-preview { font-size: 0.85rem; color: var(--ink-muted); margin: 0.3rem 0; }
.picked-library-images { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0; }
.picked-doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: var(--space-1) 0.7rem;
  font-size: 0.8rem;
}
.remove-picked-doc-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.remove-picked-doc-btn:hover { color: var(--logo-red); }

/* Document tags -- shared between the Library grid's read-only display and
   the tag editor in the image zoom modal (see openImageZoomModal() /
   wireImageTagsEditor() in app.js). */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.image-tags-editor { margin-top: var(--space-3); }
.image-tags-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: var(--space-2); min-height: 1.5rem; }
.image-tags-editor .tag-chip { color: var(--ink); }
.remove-tag-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}
.remove-tag-btn:hover { color: var(--logo-red); }
.image-tags-add-form { display: flex; gap: var(--space-2); }
.image-tags-input { flex: 1; }

/* Stories module (Everyday Miracles story cards). Shared fields (photo,
   author, date) live in one top card; everything that varies per language
   (lead/summary/reference/source_url/audio) lives in a per-language card
   switched via a tab bar -- see manager/public/assets/story-detail.js. */
.story-main-form { display: flex; flex-direction: column; gap: var(--space-4); }

.story-top-grid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: var(--space-6); }
@media (max-width: 700px) { .story-top-grid { grid-template-columns: 1fr; } }
.story-top-col { display: flex; flex-direction: column; gap: var(--space-4); }
.story-top-col label { display: flex; flex-direction: column; gap: 0.3rem; }
.story-top-col textarea { width: 100%; resize: vertical; }

.form-actions-row { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }

.story-photo-row { display: flex; gap: var(--space-5); align-items: flex-start; }
.story-photo-preview {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ground);
  flex-shrink: 0;
}

.lang-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}
.lang-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.lang-tab-btn:hover { color: var(--ink); }
.lang-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.lang-tab-panel { display: flex; flex-direction: column; gap: var(--space-4); }
/* Same specificity as the two rules above ([hidden] and .lang-tab-panel are
   both one selector), and this app.css loads after the UA stylesheet, so
   without this override [hidden] loses the cascade and the "inactive"
   language panel stays visible below the active one -- confirmed live via
   a screenshot before this rule was added. */
.lang-tab-panel[hidden] { display: none; }
.lang-text-form { display: flex; flex-direction: column; gap: var(--space-4); }
.lang-text-form label { display: flex; flex-direction: column; gap: 0.3rem; }

/* Home Widget item page (manager/public/assets/news-widget-item.js): the
   "Translate" button sits right below the EN/SP/FR .lang-tab-panel set,
   with its status message inline next to it rather than stacked. */
.nw-translate-row { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }

/* Audio narration card: first card within each language tab panel (see
   manager/public/assets/story-detail.js). Voice ID lives here (saved on
   its own, independent of the upload form below it) since it's the
   ElevenLabs voice that produced -- or will produce -- this narration. */
.lang-voice-id-form { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: var(--space-4); }
.lang-voice-id-form label { display: flex; flex-direction: column; gap: 0.3rem; max-width: 320px; }
.lang-voice-id-form .form-actions-row { margin-top: 0.3rem; }
.story-audio-filename {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  word-break: break-all;
}
.lang-tab-panel audio { width: 100%; max-width: 360px; display: block; margin-bottom: 0.4rem; }

/* Shared "show in public widget" toggle, in the top card between the
   Author/Date/Country/Voice profile fields and the Save button (see
   manager/public/assets/story-detail.js). Immediate-save on click, not
   part of the form's own Save button. */
.story-show-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.show-toggle-btn {
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  cursor: pointer;
}
.show-toggle-btn--yes {
  background: var(--success);
  color: #fff;
  border: 1px solid var(--success);
}
.show-toggle-btn--no {
  background: none;
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

/* Same yes/no color language as .show-toggle-btn above, but sized as a
   compact pill for the stories list table (manager/public/assets/stories.js)
   instead of a clickable button. */
.show-badge {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.show-badge--yes {
  background: var(--success);
  color: #fff;
}
.show-badge--no {
  background: none;
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

/* Widget Preview page (pages/story-preview.php) -- the device-frame chooser
   chrome around the embedded iframe. The widget's own CSS (what's actually
   inside that iframe) stays in assets/everyday_miracles/css/, untouched by
   any of this -- this is only the picker UI wrapped around it. Prefixed
   pv- since .lang-tabs above is already taken by the story editor's own
   language tabs and isn't the same component. */
.pv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.6rem var(--space-4);
  border-bottom: 1px solid var(--border);
}
.pv-title {
  margin: 0;
  font-size: 1.15rem;
  white-space: nowrap;
}
.pv-toolbar-controls, .pv-lang-tabs, .pv-mode-tabs, .pv-os-tabs, .pv-device-toolbar, .pv-phone-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pv-toolbar-controls { gap: var(--space-4); flex-wrap: wrap; }
.pv-lang-tab, .pv-mode-tab, .pv-os-tab {
  text-decoration: none;
  color: var(--ink-muted);
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.pv-lang-tab.active, .pv-mode-tab.active, .pv-os-tab.active {
  background: var(--primary);
  color: #fff;
}
.pv-lang-tabs { padding-right: var(--space-3); border-right: 1px solid var(--border); }
/* Same tab look as .pv-lang-tabs (pages/story-preview.php), reused for
   pages/stories-analytics.php's date-range switcher -- without the
   border-right, which only made sense sitting beside that page's other
   toolbar controls. */
.stats-range-tabs { display: flex; align-items: center; gap: 0.4rem; margin-bottom: var(--space-5); }
.pv-os-tabs { padding-right: 0.4rem; border-right: 1px solid var(--border); }
#pv-model-select {
  font-size: 0.85rem;
  padding: 0.3rem var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
#pv-phone-controls[hidden] { display: none; }

#pv-device-stage {
  background: #e9e9ee;
  padding: var(--space-4);
  display: flex;
  justify-content: center;
  overflow: auto;
}
#pv-device-stage.pv-mode-desktop { background: #e9e9ee; }
#pv-device-viewport { position: relative; }
#pv-device-frame { position: relative; transform-origin: top left; }
#pv-device-frame iframe { display: block; border: 0; width: 100%; height: 900px; }

/* Desktop mode: no bezel, just a plain bordered box sized to its own
   content (the iframe's explicit px width/height) so the resize handles
   below sit flush against its real edges instead of the stage's edges. */
#pv-device-frame.pv-resizable {
  display: inline-block;
  background: #fff;
  box-shadow: 0 0 0 1px var(--border);
}
.pv-resize-handle { display: none; position: absolute; z-index: 10; }
#pv-device-frame.pv-resizable .pv-resize-handle { display: block; }
.pv-resize-e { top: 0; right: -6px; width: 12px; height: 100%; cursor: ew-resize; }
.pv-resize-s { left: 0; bottom: -6px; height: 12px; width: 100%; cursor: ns-resize; }
.pv-resize-se { right: -6px; bottom: -6px; width: 16px; height: 16px; cursor: nwse-resize; }
.pv-resize-se::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
}
/* Covers the iframe while dragging -- an iframe has its own document, so
   mousemove targeting it mid-drag stops reaching the listeners bound on
   this page's document the instant the pointer crosses into it. */
.pv-drag-overlay { display: none; position: absolute; inset: 0; z-index: 15; }
.pv-drag-overlay.active { display: block; }

.pv-desktop-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
}
.pv-desktop-controls[hidden] { display: none; }
.pv-desktop-controls input {
  width: 68px;
  font: inherit;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

#pv-device-frame.pv-has-bezel {
  display: inline-block;
  background: #1c1c1e;
  border-radius: var(--pv-bezel-radius);
  padding: var(--pv-bezel-pad);
  box-shadow: 0 0 0 2px #3a3a3c, 0 24px 48px rgba(0, 0, 0, 0.3);
}
#pv-device-frame.pv-has-bezel iframe {
  border-radius: var(--pv-screen-radius);
  background: #fff;
}
.pv-device-cutout { display: none; position: absolute; left: 50%; transform: translateX(-50%); background: #1c1c1e; z-index: 5; }
#pv-device-frame.pv-cutout-notch .pv-device-cutout { display: block; top: 14px; width: 46%; height: 26px; border-radius: 0 0 14px 14px; }
#pv-device-frame.pv-cutout-island .pv-device-cutout { display: block; top: 28px; width: 90px; height: 28px; border-radius: 20px; }
#pv-device-frame.pv-cutout-punch .pv-device-cutout { display: block; top: 26px; width: 14px; height: 14px; border-radius: 50%; }

.pv-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: #fff;
  color: var(--ink-muted);
  font-size: 0.85rem;
  border-radius: inherit;
}
.pv-loading.pv-hidden { display: none; }
.pv-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: pv-spin 0.8s linear infinite;
}
@keyframes pv-spin {
  to { transform: rotate(360deg); }
}

.story-date-cell { white-space: nowrap; }

html.lg-EN .lg-SP,
html.lg-EN .lg-CA,
html.lg-EN .lg-FR,
html.lg-EN .lg-PT,
html.lg-EN .lg-HT {
	display: none !important;
}
html.lg-SP .lg-EN,
html.lg-SP .lg-CA,
html.lg-SP .lg-FR,
html.lg-SP .lg-PT,
html.lg-SP .lg-HT {
	display: none !important;
}
html.lg-CA .lg-EN,
html.lg-CA .lg-SP,
html.lg-CA .lg-FR,
html.lg-CA .lg-PT,
html.lg-CA .lg-HT {
	display: none !important;
}
html.lg-FR .lg-EN,
html.lg-FR .lg-SP,
html.lg-FR .lg-CA,
html.lg-FR .lg-PT,
html.lg-FR .lg-HT {
	display: none !important;
}
html.lg-PT .lg-EN,
html.lg-PT .lg-SP,
html.lg-PT .lg-FR,
html.lg-PT .lg-CA,
html.lg-PT .lg-HT {
	display: none !important;
}
html.lg-HT .lg-EN,
html.lg-HT .lg-SP,
html.lg-HT .lg-CA,
html.lg-HT .lg-FR,
html.lg-HT .lg-PT {
	display: none !important;
}

/* ==========================================================================
   St. Bernadette USA design system (2026-09) -- header, profile menu,
   sidebar restyle and the dashboard. Kept as one block
   at the end so it reads as a layer over the rules above.
   ========================================================================== */

h1, h2, .display-font {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}
.main-content h1 { font-size: 2rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Top header ---------------------------------------------------------- */
.top-header {
  justify-content: space-between;
  gap: 1.75rem;
  padding: 0 var(--space-5) 0 1.1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 214px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--ink);
}
.brand img { height: 54px; width: auto; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1; }
.brand-sub { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.14em; color: var(--ink-muted); text-transform: uppercase; }

.header-search {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 42px;
  padding: 0 0.9rem;
  background: var(--ground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--ink);
}
.header-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  outline: none;
  padding: 0;
}
.header-search:focus-within { border-color: var(--primary); }

.header-spacer { flex: 1; }

/* ---- Profile button ------------------------------------------------------- */
.profile { position: relative; flex-shrink: 0; }

.profile-btn {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-btn .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
}
/* No uploaded photo: the user's initials in the display face, dark ink on
   a soft blue disc, inside a thin ring of the same blue. */
.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--avatar-bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
}
.profile-btn .avatar,
.pm-identity .avatar,
.profile-photo-preview .avatar {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--avatar-bg);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 392px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(29, 51, 60, 0.18);
  color: var(--ink);
}
.pm-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 1.1rem var(--space-5);
  border-bottom: 1px solid var(--border);
}
.pm-identity .avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.pm-identity .avatar-initials { font-size: 1.1rem; }
.pm-identity-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pm-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.pm-subtle { font-size: 0.9rem; color: var(--ink-muted); }



.pm-menu { display: flex; flex-direction: column; padding: var(--space-2) var(--space-2) 0.6rem; border-top: 1px solid var(--border); }
.pm-menu a {
  display: flex; align-items: center; gap: var(--space-3);
  height: 40px; padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.pm-menu a:hover { background: var(--ground); }
.pm-menu a.active { background: var(--primary-soft); color: var(--primary-strong); }
.pm-menu a i { width: 1.1em; text-align: center; }
.pm-menu-label { padding: 0.6rem var(--space-3) var(--space-1); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-muted); }
.pm-menu hr { border: 0; border-top: 1px solid var(--border); margin: 0.4rem var(--space-1); }
.pm-menu a.pm-signout { color: var(--danger-ink); }

/* ---- Sidebar, restyled after the Parish Mate panel -------------------------- */
.side-nav { padding: var(--space-4) var(--space-2); gap: 2px; }
#nav-collapse-btn { top: 1.2rem; right: 6px; }
.nav-toolbar { padding: 0 1.9rem 0.6rem 0; }
#nav-collapse-all-btn {
  justify-content: flex-start;
  gap: 0.6rem;
  height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#nav-collapse-all-btn:hover { color: var(--primary); border-color: var(--primary); }

.nav-group-label,
.nav-link.nav-top-item {
  padding: 0.7rem var(--space-2);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.nav-group-label.active { color: var(--ink); }
.tree-toggle { font-size: 0.85rem; width: 0.9em; color: var(--ink); }
.tree-toggle-spacer { font-size: 0.85rem; }
.nav-link-icon { color: var(--ink); }

.nav-link { border-left: 0; border-radius: var(--radius-md); }
.nav-sublink { padding-left: 2.6rem; font-size: 0.95rem; }
.nav-link:hover { background: var(--ground); }
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}
.nav-link.active .nav-link-icon { color: var(--primary-strong); }

/* ---- Dashboard -------------------------------------------------------------- */
.main-content.dashboard { max-width: var(--page-max); width: 100%; padding: 1.9rem var(--space-10) var(--space-10); display: flex; flex-direction: column; gap: 1.9rem; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.dash-date { font-size: 0.875rem; font-weight: 500; letter-spacing: 0.06em; color: var(--ink-muted); text-transform: uppercase; }
.dash-head h1 { margin: 0.1rem 0 0; font-size: 2.25rem; }
.dash-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
/* ---- Buttons ----------------------------------------------------------------
   The one button system for the whole app. Always `btn` + one variant
   (primary / outline / soft / danger) + optional size (sm 40px, xs 32px;
   default 44px). Works on <button> and <a> alike. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 44px; padding: 0 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink);
  font: 600 0.95rem/1 var(--font-sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover { border-color: var(--primary-strong); background: var(--primary-strong); color: #fff; }
.btn-outline { border-color: var(--border-strong); background: var(--surface); color: var(--ink); }
.btn-outline:hover { background: var(--ground); }
.btn-soft { border-color: var(--primary-soft); background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.btn-soft:hover { border-color: var(--primary-soft-hover); background: var(--primary-soft-hover); color: var(--primary-strong); }
.btn-danger { border-color: var(--logo-red); background: var(--surface); color: var(--logo-red); }
.btn-danger:hover { background: var(--logo-red); color: #fff; }
.btn-sm { height: 40px; padding: 0 0.9rem; font-size: 0.9rem; }
.btn-xs { height: 32px; padding: 0 var(--space-3); font-size: 0.82rem; gap: 0.4rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }

.dash-section { display: flex; flex-direction: column; gap: 0.9rem; }
.dash-section-head { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; flex-wrap: wrap; }
.dash-section-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.dash-section-title h2 { margin: 0; font-size: 1.45rem; }
.dash-hint { font-size: 0.9rem; color: var(--ink-muted); }
.dash-more { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.9rem; color: var(--primary); text-decoration: none; }

.dash-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.dash-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.dash-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.dash-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 1100px) {
  .dash-grid-4, .dash-grid-5, .dash-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid-2 { grid-template-columns: 1fr; }
}

.dash-card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.attn-top { display: flex; align-items: center; justify-content: space-between; }
.attn-top i { font-size: 1.5rem; color: var(--ink); }
.stat-num {
  font-family: var(--font-display);
  font-variant-numeric: lining-nums;
  font-weight: 700;
  font-size: 2.125rem;
  line-height: 1;
  color: var(--primary);
}
.attn-card.urgent .stat-num { color: var(--logo-red); }
.attn-card.warn .stat-num, .attn-card.clear .stat-num { color: var(--ink); }
.attn-title { font-weight: 700; font-size: 1rem; }
.dash-meta { font-size: 0.9rem; color: var(--ink-muted); }
.attn-card .dash-more { margin-top: auto; padding-top: 0.35rem; }

.stat-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }
.stat-card .stat-num { line-height: 1.1; }
.mini-bars { display: flex; align-items: flex-end; gap: 6px; height: 46px; }
.mini-bar { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mini-bar div { width: 20px; border-radius: 3px 3px 0 0; background: var(--primary-soft); border: 1px solid var(--border-strong); border-bottom: 0; }
.mini-bar.current div { background: var(--primary); border-color: var(--primary); }
.mini-bar span { font-size: 0.7rem; color: var(--ink-muted); }

.tour-now {
  position: relative; overflow: hidden;
  display: flex; gap: var(--space-4); align-items: center;
  padding: var(--space-5) 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--ink); color: #fff;
}
.tour-now .ribbons { position: absolute; right: -30px; bottom: -34px; opacity: 0.9; pointer-events: none; }
.tour-now .ribbon-primary { stroke: var(--primary); }
.tour-now .ribbon-red { stroke: var(--logo-red); }
.tour-now-badge {
  position: relative;
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--star-gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--star-gold); font-size: 1.4rem; flex-shrink: 0;
}
.tour-now-text { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tour-now-eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; color: var(--star-gold-light); }
.tour-now-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.tour-now-meta { font-size: 0.9rem; color: var(--ink-inverse-muted); }

.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dash-list li { display: flex; align-items: center; gap: 0.9rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.dash-list li:last-child { border-bottom: 0; }
.stop-date { width: 5.2rem; flex-shrink: 0; font-weight: 700; color: var(--primary); }
.stop-name { flex: 1; font-weight: 500; min-width: 0; }
.stop-place { color: var(--ink-muted); text-align: right; }
.act-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; align-self: flex-start; margin-top: 0.4rem; background: var(--primary); }
.act-dot.failed { background: var(--logo-red); }
.act-dot.running, .act-dot.pending { background: var(--star-gold); }
.act-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.act-body strong { font-weight: 700; }
.act-when { font-size: 0.875rem; font-weight: 600; white-space: nowrap; align-self: flex-start; }
.dash-empty { color: var(--ink-muted); padding: var(--space-2) 0; }

.chip-outline {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 3px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--ink); color: var(--ink);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.art-tile { display: flex; flex-direction: column; gap: var(--space-2); color: var(--ink); text-decoration: none; min-width: 0; }
.art-tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); }
.art-tile span { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md); border: 2px dashed var(--border-strong);
  background: var(--surface); color: var(--primary);
  font-weight: 700; text-decoration: none;
}
.art-new-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.skeleton { color: var(--ink-muted); }

/* ---- Narrow screens: icon-rail sidebar, compact header ---------------------- */
@media (max-width: 820px) {
  .top-header { gap: var(--space-3); padding: 0 var(--space-3); }
  .brand { width: auto; }
  .brand-text, .header-search { display: none; }
  .side-nav { width: var(--sidebar-collapsed-w); padding-left: var(--space-1); padding-right: var(--space-1); }
  .side-nav .nav-label, .side-nav .nav-sublink, .side-nav .nav-toolbar,
  .side-nav .tree-toggle, .side-nav .tree-toggle-spacer, #nav-collapse-btn { display: none; }
  .side-nav .nav-link, .side-nav .nav-group-label { justify-content: center; padding-left: 0; padding-right: 0; }
  .main-content.dashboard { padding: var(--space-5) var(--space-4) var(--space-8); min-width: 0; }
  .dash-head h1 { font-size: 1.7rem; }
}
@media (max-width: 600px) {
  .dash-grid-4, .dash-grid-5, .dash-grid-2, .dash-grid-3 { grid-template-columns: 1fr; }
  .dash-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Profile photo (pages/user.php) ------------------------------------------ */
.profile-photo-row { display: flex; gap: var(--space-6); align-items: flex-start; flex-wrap: wrap; }
.profile-photo-preview .avatar { width: 96px; height: 96px; border-radius: 50%; display: flex; object-fit: cover; }
.profile-photo-preview .avatar-initials { font-size: 2.2rem; }
.profile-photo-preview { padding: 6px; }
.profile-photo-actions { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-width: 240px; }
.profile-photo-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.profile-photo-buttons button[hidden] { display: none; }

/* ==========================================================================
   Art Studio (Overview, Style Guides, References, Illustrations, Gallery)
   ========================================================================== */
.main-content.as-page { max-width: var(--page-max); width: 100%; padding: 1.6rem var(--space-10) var(--space-10); display: flex; flex-direction: column; gap: 1.75rem; }
/* Every page uses .as-page: the column's gap spaces its direct children, so
   their own outer margins are zeroed here (pages written before the design
   system still carry margin-based spacing on h1, .card, p, etc.). */
.as-page > * { margin-top: 0; margin-bottom: 0; min-width: 0; }
.as-page > :is(a, button, span, img) { align-self: flex-start; }
.as-page > h1, .as-page > .list-toolbar h1 { font-size: 2.25rem; margin: 0; }
.as-page > h1 + .page-intro, .as-page > .list-toolbar + .page-intro { margin-top: calc(0.35rem - 1.75rem); font-size: 1.05rem; max-width: 700px; }
.as-page > .card { margin-bottom: 0; }
/* Full-bleed tool pages (story-preview.php): no width cap, tighter padding. */
.main-content.as-page.as-page--full { max-width: none; padding: var(--space-5) var(--space-6); gap: var(--space-4); }
.as-page .breadcrumbs { margin: 0; }
.as-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.as-head h1 { margin: 0; font-size: 2.25rem; }
.as-head p { margin: 0.35rem 0 0; max-width: 700px; font-size: 1.05rem; }
.as-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.as-section { display: flex; flex-direction: column; gap: 0.85rem; }
.as-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.as-section-head h2 { margin: 0; font-size: 1.45rem; }
.as-section-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.as-muted { color: var(--ink-muted); font-size: 0.9rem; }
.as-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.as-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--ground); border: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; }
.as-chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); font-weight: 700; }
.as-chip.info { background: var(--primary-soft); border-color: transparent; color: var(--primary-strong); font-weight: 700; letter-spacing: 0.04em; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.as-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.as-thumb { width: 100%; object-fit: cover; border-radius: var(--radius-md); background: var(--ground); display: block; }
.as-thumb-empty { display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--ground); border: 1px dashed var(--border-strong); color: var(--ink-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; }
.as-doc-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-strong); font-size: 0.75rem; font-weight: 700; }
.as-num { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; }

/* Overview */
.as-hero { display: flex; gap: var(--space-8); padding: var(--space-8); }
.as-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.as-eyebrow { display: flex; align-items: center; gap: var(--space-2); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; }
.as-hero h1 { margin: 0; font-size: 2.6rem; line-height: 1.1; text-wrap: balance; }
.as-hero p { margin: 0; max-width: 600px; font-size: 1.06rem; line-height: 1.55; }
.as-hero-stats { display: flex; flex-wrap: wrap; gap: var(--space-2) 1.4rem; margin-top: auto; padding-top: 1.1rem; border-top: 1px solid var(--border); font-size: 0.9rem; color: var(--ink-muted); }
.as-hero-stats strong { color: var(--ink); font-size: 1rem; }
.as-hero-art { width: 440px; flex-shrink: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 145px 145px; gap: 10px; }
.as-hero-art > :first-child { grid-row: span 2; height: 100%; }
.as-hero-art > * { height: 145px; }
.as-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.as-step { display: flex; flex-direction: column; gap: 0.6rem; padding: var(--space-5); }
.as-step-head { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; }
.as-step p { margin: 0; font-size: 0.92rem; }
.as-step-get { margin-top: auto; padding: 0.6rem var(--space-3); border-radius: var(--radius-md); background: var(--ground); font-size: 0.86rem; }
.as-modules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.as-module { display: flex; gap: var(--space-5); padding: var(--space-5); }
.as-module-art { width: 190px; flex-shrink: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 91px 91px; gap: 6px; }
.as-module-art > :first-child { grid-row: span 2; height: 188px; }
.as-module-art > * { height: 91px; }
.as-module-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.as-module-body h3 { margin: 0; font-family: var(--font-display); font-size: 1.3rem; }
.as-module-body p { margin: 0; font-size: 0.92rem; }
.as-module-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.as-module .as-actions { margin-top: auto; gap: var(--space-4); }
.as-rows { display: flex; flex-direction: column; }
.as-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); }
.as-row:last-child { border-bottom: 0; }
.as-row-thumb { width: 52px; height: 52px; flex-shrink: 0; object-fit: cover; border-radius: var(--radius-md); }
.as-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.as-row-body strong { font-size: 1rem; }
@media (max-width: 1100px) {
  .as-steps, .as-modules { grid-template-columns: 1fr; }
  .as-hero { flex-direction: column; }
  .as-hero-art { width: 100%; }
}

/* Style Guides */
.sg-explainer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); padding: 1.1rem var(--space-5); }
.sg-explainer > div { display: flex; gap: var(--space-3); }
.sg-explainer i { font-size: 1.4rem; margin-top: 2px; width: 1.4rem; text-align: center; }
.sg-explainer strong { display: block; }
.sg-explainer span { font-size: 0.9rem; }
.sg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.sg-card { display: flex; flex-direction: column; overflow: hidden; }
.sg-card-art { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; height: 200px; background: var(--ground); }
.sg-card-art img, .sg-card-art .as-thumb-empty { width: 100%; height: 200px; object-fit: cover; border-radius: 0; border: 0; }
.sg-card-art.single { grid-template-columns: 1fr; }
.sg-card-body { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem; flex: 1; }
.sg-card-body h2 { margin: 0; font-size: 1.25rem; }
.sg-card-body p { margin: 0; font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sg-card .as-actions { margin-top: auto; padding-top: var(--space-1); flex-wrap: nowrap; gap: 0.4rem; }
.sg-card .as-actions .btn-sm { height: 34px; padding: 0 0.65rem; font-size: 0.78rem; white-space: nowrap; }
.sg-card .as-actions .btn-sm:not(.btn-soft) { flex-shrink: 0; }
/* On a narrow card the long label gives way ("Create with this st…") so the row never wraps. */
.sg-card .as-actions .btn-soft { display: block; min-width: 0; line-height: 32px; overflow: hidden; text-overflow: ellipsis; }
.sg-card .as-actions .sg-delete-btn { width: 34px; padding: 0; justify-content: center; }
.as-chip.locked { background: transparent; border-color: var(--ink); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; }
@media (max-width: 1100px) { .sg-grid, .sg-explainer { grid-template-columns: 1fr; } }

/* References */
.as-tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.as-tab { height: 44px; padding: 0 var(--space-4); border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink); font: 600 0.95rem var(--font-sans); cursor: pointer; }
.as-tab[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary-strong); font-weight: 700; }
.as-tab .as-muted { margin-left: var(--space-1); }
.as-menu { position: relative; }
.as-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; padding: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 14px 34px rgba(29, 51, 60, 0.16); display: flex; flex-direction: column; }
.as-menu-list[hidden] { display: none; }
.as-menu-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 0.55rem var(--space-3); border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.as-menu-list button:hover { background: var(--ground); }
.as-menu-list button span { font-size: 0.82rem; color: var(--ink-muted); }
.as-search { display: flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 260px; }
.as-search input { flex: 1; border: 0 !important; background: transparent !important; padding: 0 !important; font: inherit; color: var(--ink); outline: none; }
.as-search:focus-within { border-color: var(--primary); }
.ref-char-layout { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); align-items: start; }
.ref-char-list { display: flex; flex-direction: column; gap: var(--space-4); }
.ref-char-card { display: flex; gap: var(--space-5); padding: var(--space-5); }
.ref-char-art { width: 200px; flex-shrink: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ref-char-art > :first-child { grid-column: span 2; height: 200px; }
.ref-char-art > * { height: 64px; }
.ref-more { display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--ground); border: 1px solid var(--border); font-weight: 700; font-size: 0.85rem; }
.ref-char-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.ref-char-body h3 { margin: 0; font-family: var(--font-display); font-size: 1.35rem; }
.ref-desc { margin: 0; padding: var(--space-3) 0.9rem; border-radius: var(--radius-md); background: var(--ground); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.ref-add-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; min-height: 260px; padding: var(--space-5); border-radius: var(--radius-lg); border: 2px dashed var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; text-align: center; cursor: pointer; }
.ref-add-card:hover { border-color: var(--primary); }
.ref-add-card strong { color: var(--primary); font-size: 1rem; }
.ref-add-card span:last-child { font-size: 0.9rem; max-width: 260px; }
.ref-add-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.ref-img-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.9rem; }
.ref-img-grid .image-cell { display: flex; flex-direction: column; gap: 0.4rem; padding: 0; border: 0; background: none; }
.ref-img-grid .image-cell img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); }
.ref-img-grid .ref-caption { font-size: 0.86rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.ref-doc-list { display: flex; flex-direction: column; gap: var(--space-3); }
.ref-doc { display: flex; gap: 1.1rem; align-items: flex-start; padding: var(--space-5); }
.ref-doc .as-doc-tile { width: 64px; height: 80px; flex-shrink: 0; }
.ref-doc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.ref-doc-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.ref-doc-body p { margin: 0; font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
[data-ref-section][hidden] { display: none; }
@media (max-width: 1100px) { .ref-char-layout { grid-template-columns: 1fr; } .ref-img-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ref-char-card { flex-direction: column; } .ref-char-art { width: 100%; } }

/* Illustrations */
.il-strip { display: flex; overflow: hidden; }
.il-strip > div { flex: 1; display: flex; align-items: center; gap: var(--space-3); padding: 0.85rem 1.1rem; border-right: 1px solid var(--border); font-size: 0.92rem; }
.il-strip > div:last-child { border-right: 0; }
.as-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.as-pill { height: 38px; padding: 0 0.9rem; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: 600 0.9rem var(--font-sans); cursor: pointer; }
.as-pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.il-table { display: flex; flex-direction: column; }
.il-row { display: grid; grid-template-columns: minmax(0, 3.2fr) minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 0.7fr) minmax(0, 0.9fr) 90px; gap: var(--space-4); align-items: center; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); }
.il-row:last-child { border-bottom: 0; }
.il-row.il-head { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 0.8rem; padding-bottom: 0.8rem; }
.il-row > span { font-size: 0.9rem; }
.il-main { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.il-thumbs { width: 104px; height: 56px; flex-shrink: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.il-thumbs img, .il-thumbs .as-thumb-empty { width: 100%; height: 56px; object-fit: cover; border-radius: var(--radius-md); }
.il-name { display: flex; flex-direction: column; min-width: 0; }
.il-name strong { font-size: 1rem; }
.il-name span { font-size: 0.86rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.il-open { display: flex; align-items: center; justify-content: center; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); color: var(--ink); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.il-open:hover { background: var(--ground); }
@media (max-width: 1100px) { .il-strip { flex-direction: column; } .il-strip > div { border-right: 0; border-bottom: 1px solid var(--border); } .il-row { grid-template-columns: minmax(0, 1fr) 90px; } .il-row > span, .il-row.il-head { display: none; } }

/* Gallery */
.ga-layout { display: flex; gap: var(--space-5); align-items: flex-start; }
.ga-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; }
.ga-card { position: relative; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.ga-card[aria-pressed="true"] { border: 2px solid var(--primary); padding: calc(var(--space-2) - 1px); }
.ga-card img, .ga-card .as-doc-tile { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); }
.ga-card .as-doc-tile i { font-size: 2.4rem; }
.ga-badge { align-self: flex-start; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--ground); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ga-badge.illustration { background: var(--primary-soft); color: var(--primary-strong); }
.ga-badge.style { background: var(--warn-soft); color: var(--warn-ink); }
.ga-badge.unused { background: var(--danger-soft); color: var(--danger-ink); }
.ga-card-name { font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ga-aside { width: 330px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0.85rem; padding: 1.1rem; position: sticky; top: calc(var(--header-h) + 16px); }
.ga-aside img, .ga-aside .as-doc-tile { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-md); }
.ga-aside .as-doc-tile i { font-size: 3rem; }
.ga-aside-name { font-weight: 700; font-size: 1rem; word-break: break-word; }
.ga-aside ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.ga-aside .btn { justify-content: center; width: 100%; }
.ga-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: 0.9rem; }
@media (max-width: 1100px) { .ga-layout { flex-direction: column; } .ga-aside { width: 100%; position: static; } .ga-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.library-page.as-page { max-width: 1400px; }
.ga-footer.library-pagination { margin-top: 0; padding: 0; border: 0; }

/* ==========================================================================
   Relic Style (new illustration engine): Art Studio creation, style guides,
   QA scores. Shared pieces are built by assets/relic-ui.js.
   ========================================================================== */

/* ---- Create an illustration (Art Studio overview) ---- */
.rx-palette { display: flex; height: 8px; overflow: hidden; border-radius: var(--radius-pill); }
.rx-palette-tall { height: 100%; border-radius: 0; }
.rx-stats { margin: 0; padding: 0; border: 0; }

/* ---- Result panel ---- */
.rx-run { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.rx-run-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.rx-progress { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.rx-progress .status-fail { margin: 0; }

/* Background-job progress bar (app.js createProgressBar()), used by every
   long-running process instead of a list of its stages. */
.pbar { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-width: 0; }
.pbar-track { flex: 1; min-width: 60px; height: 8px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.pbar-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.4s linear; }
.pbar-pct { flex-shrink: 0; min-width: 3.2ch; text-align: right; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-muted); }
.pbar.is-failed .pbar-fill { background: var(--logo-red); }
.pbar-compact .pbar-track { height: 6px; }
@media (prefers-reduced-motion: reduce) { .pbar-fill { transition: none; } }
.ws-pending:has(.pbar) { width: 100%; }
.ws-pending .pbar, .ws-overlay .pbar { width: 240px; max-width: 100%; }
.rx-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.82rem; font-weight: 700; }
.rx-badge.ok { background: var(--success-soft); color: var(--success); }
.rx-badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.rx-badge.bad { background: var(--danger-soft); color: var(--danger-ink); }
.rx-scores { display: flex; flex-direction: column; gap: var(--space-2); }
.rx-score { display: grid; grid-template-columns: 76px minmax(0, 1fr) 32px; align-items: center; gap: var(--space-3); font-size: 0.9rem; }
.rx-score b { text-align: right; font-variant-numeric: tabular-nums; }
.rx-track { position: relative; height: 8px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); }
.rx-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--radius-pill); background: var(--primary); }
.rx-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.rx-score.fail .rx-fill { background: var(--logo-red); }
.rx-score.fail b { color: var(--logo-red); }
.rx-note { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn-ink); font-size: 0.9rem; }
.rx-details { border-top: 1px solid var(--border); padding-top: var(--space-3); }
.rx-details summary { cursor: pointer; font-weight: 600; }
.rx-notes { margin: var(--space-2) 0 0; padding-left: 1.2rem; font-size: 0.9rem; }
.rx-prompt { margin: var(--space-2) 0 0; max-height: 280px; overflow: auto; padding: var(--space-3); white-space: pre-wrap; font-size: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.rx-content { margin: var(--space-2) 0 0; display: grid; gap: 6px; }
.rx-content > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: var(--space-2); }
.rx-content dt { font-size: 0.8rem; font-weight: 700; color: var(--ink-muted); }
.rx-content dd { margin: 0; font-size: 0.9rem; }
.rx-attempts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-3); margin-top: var(--space-2); }
.rx-attempt { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.rx-attempt img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-md); }
.rx-attempt.is-final img { border: 2px solid var(--primary); }
.rx-error .rx-run-head i { color: var(--logo-red); }
.rx-error p { margin: 0; }

/* ---- Style guides (list, new style, detail) ---- */
.sg-card-art .rx-palette-tall { grid-column: span 2; height: 200px; }
.rx-card-palette { margin: 0 1.1rem; }
.rx-drop { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-6); border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--ground); text-align: center; cursor: pointer; }
.rx-drop.is-over, .rx-drop:hover { border-color: var(--primary); }
.rx-drop strong { color: var(--primary); }
.rx-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: var(--space-2); }
.rx-thumbs figure { position: relative; margin: 0; }
.rx-thumbs img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-md); }
.rx-thumbs button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(29, 51, 60, 0.7); color: #fff; cursor: pointer; }
.rx-keep { margin: 0; padding: var(--space-3); border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-strong); font-size: 0.88rem; }
.rx-banner { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--warn-soft); color: var(--warn-ink); }
.rx-banner p { margin: 0; flex: 1; min-width: 240px; }
.rx-profile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); padding: var(--space-6); }
.rx-profile-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.rx-profile h2 { margin: 0; font-size: 1.2rem; }
.rx-core { margin: 0; font-size: 1.02rem; line-height: 1.5; }
.rx-meta { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.rx-meta dt { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.rx-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.rx-samples { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.rx-samples img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-md); }
.rx-traits { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: var(--space-2); }
.rx-strengths { display: flex; flex-direction: column; gap: 6px; }
.rx-strength { display: grid; grid-template-columns: 100px minmax(0, 1fr) 40px; align-items: center; gap: var(--space-3); font-size: 0.9rem; }
.rx-strength b { text-align: right; font-variant-numeric: tabular-nums; }
.rx-versions { display: flex; flex-direction: column; }
.rx-version { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border); }
.rx-version:last-child { border-bottom: 0; }
.rx-version-body { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.rx-version.is-viewing { background: var(--ground); }
.rx-editor { padding: var(--space-5) var(--space-6); }
.rx-editor > summary { cursor: pointer; font-weight: 700; }
.rx-editor .group { border-top: 1px solid var(--border); padding: var(--space-3) 0; }
.rx-editor .group > summary { cursor: pointer; font-weight: 600; }
.rx-group-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.rx-group-fields .field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; min-width: 0; }
.rx-group-fields textarea { width: 100%; resize: vertical; font-size: 0.9rem; }
.rx-group-fields .rx-wide { grid-column: 1 / -1; }
.rx-palette-row, .rx-list-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.rx-palette-row input[type=number] { width: 80px; }
.rx-list-row textarea { flex: 1; min-width: 200px; }
.rx-save-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.rx-violations { margin: 0; padding-left: 1.2rem; color: var(--danger-ink); font-size: 0.88rem; }
.rx-qa-chip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.72rem; color: var(--ink-muted); }

@media (max-width: 1100px) {
}
@media (max-width: 600px) {
  .rx-group-fields, .rx-meta { grid-template-columns: 1fr; }
  .rx-profile { padding: var(--space-4); }
}
#style-guide-detail > .rx-banner { margin-bottom: var(--space-4); }
/* author display rules would otherwise beat the [hidden] attribute (same issue as .lang-tab-panel[hidden]) */
[class*="rx-"][hidden] { display: none !important; }
@media (max-width: 600px) {
  .as-module { flex-direction: column; }
  .as-module-art { width: 100%; }
  .as-module-art > :first-child { height: 140px; }
  .as-section-head { align-items: flex-start; }
}
@media (max-width: 600px) {
  .rx-score { grid-template-columns: 68px minmax(0, 1fr) 28px; gap: var(--space-2); }
}

/* ==========================================================================
   Art Studio workspace (pages/art-studio.php): creation panel on the left,
   Creations feed on the right. Built by assets/art-studio.js.
   ========================================================================== */
[class*="ws-"][hidden] { display: none !important; }
.main-content.as-page.ws-page { max-width: none; padding: var(--space-5) var(--space-6) var(--space-8); }
.ws { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--space-6); align-items: start; }

/* ---- Panel ---- */
.ws-panel { position: relative; z-index: 9; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
/* Stays in view while the feed scrolls, only while all of it fits on screen
   (art-studio.js measures it and sets .is-sticky); a taller panel scrolls with
   the page so nothing is cut off. No overflow on the panel: its menus must be
   free to extend past it. */
@media (min-width: 1101px) { .ws-panel.is-sticky { position: sticky; top: calc(var(--header-h) + var(--space-5)); } }
.ws-form { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5) var(--space-5) 0; min-height: 100%; }
.ws-grow { flex: 1; min-width: 0; }
.ws-menu { position: relative; }
.ws-select { width: 100%; height: 44px; display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 600 0.95rem var(--font-sans); cursor: pointer; text-align: left; }
.ws-select:hover { border-color: var(--primary); }
.ws-select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-thumb { display: inline-flex; width: 40px; height: 40px; flex-shrink: 0; overflow: hidden; border-radius: var(--radius-sm); background: var(--ground); }
.ws-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ws-thumb .rx-palette { width: 100%; }
.ws-thumb-fill { width: 100% !important; height: 100% !important; border-radius: 0; object-fit: cover; }
.ws-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: calc(-1 * var(--space-2)); }
.ws-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.ws-count { font-size: 0.78rem; color: var(--ink-muted); }

.ws-tiles { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ws-photo-tiles { display: contents; }
.ws-tile { position: relative; width: 74px; height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--ground); color: var(--ink); font: 600 0.75rem var(--font-sans); cursor: pointer; overflow: hidden; }
.ws-tile:hover, .ws-tile.is-on { border-color: var(--primary); }
.ws-tile-art { display: flex; align-items: center; justify-content: center; width: 100%; flex: 1; min-height: 0; font-size: 1.1rem; color: var(--ink); }
.ws-tile-label { width: 100%; padding: 0 4px 6px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-tile .ws-tile-art:has(img), .ws-tile .ws-tile-art:has(.ws-thumb) { position: absolute; inset: 0; }
.ws-tile:has(.ws-tile-art img) .ws-tile-label, .ws-tile:has(.ws-tile-art .ws-thumb) .ws-tile-label, .ws-tile-photo .ws-tile-tag { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 4px 5px; color: #fff; background: linear-gradient(transparent, rgba(29, 51, 60, 0.85)); }
.ws-tile-art .ws-thumb { width: 100%; height: 100%; border-radius: 0; }
.ws-tile-photo { cursor: default; }
.ws-tile-photo .ws-tile-tag { font-size: 0.72rem; text-align: center; }
.ws-tile-doc { cursor: default; background: var(--surface); }
.ws-tile-doc .ws-tile-art { font-size: 1.5rem; color: var(--primary); }
.ws-tile-doc .ws-tile-label { font-weight: 500; font-size: 0.7rem; }
.ws-add-pop { width: min(320px, 90vw); }
.ws-add-pop .ws-option-body span { display: block; -webkit-line-clamp: unset; }
.ws-add-pop .ws-option:disabled { opacity: 0.45; cursor: not-allowed; background: none; }
.ws-add-icon { flex-shrink: 0; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--ground); color: var(--primary); font-size: 1.05rem; }
.ws-tile-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(29, 51, 60, 0.75); color: #fff; font-size: 0.9rem; line-height: 1; cursor: pointer; }

.ws-prompt { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.ws-prompt:focus-within { border-color: var(--primary); }
.ws-prompt textarea { width: 100%; min-height: 180px; padding: 0; border: 0; background: transparent; resize: vertical; font: 400 1rem/1.5 var(--font-sans); color: var(--ink); }
.ws-prompt textarea:focus-visible { outline: none; }
.ws-prompt-note { margin: 0; display: flex; gap: 6px; align-items: baseline; font-size: 0.82rem; color: var(--ink-muted); }

.ws-controls { display: flex; gap: var(--space-2); align-items: stretch; }
.ws-stepper { display: flex; align-items: center; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
.ws-stepper button { width: 34px; height: 100%; border: 0; background: none; color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.ws-stepper button:disabled { color: var(--border-strong); cursor: default; }
.ws-stepper output { min-width: 20px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ws-chip-btn { height: 44px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: 600 0.9rem var(--font-sans); white-space: nowrap; cursor: pointer; }
.ws-chip-btn:hover { border-color: var(--primary); }
.ws-submit { margin-top: auto; padding: var(--space-3) 0 var(--space-5); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-2); }
.ws-generate { width: 100%; height: 52px; justify-content: space-between; padding: 0 var(--space-5); font-size: 1.05rem; }
.ws-status { margin: 0; font-size: 0.85rem; }

/* ---- Popovers ---- */
.ws-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 260px; max-width: min(360px, 90vw); max-height: 60vh; overflow-y: auto; padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 14px 34px rgba(29, 51, 60, 0.16); }
.ws-engine-pop { left: auto; right: 0; }
.ws-style-pop { width: min(360px, 90vw); }
.ws-model-pop { width: 100%; }
.ws-option-check { margin-left: auto; color: var(--primary); visibility: hidden; }
.ws-option[aria-selected="true"] .ws-option-check { visibility: visible; }
.ws-option { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ws-option:hover { background: var(--ground); }
.ws-option[aria-selected="true"] { border-color: var(--primary); background: var(--primary-soft); }
.ws-option-body { display: flex; flex-direction: column; min-width: 0; }
.ws-option-body span { font-size: 0.8rem; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ws-pop-foot { display: flex; flex-direction: column; gap: 6px; padding-top: var(--space-2); border-top: 1px solid var(--border); font-size: 0.88rem; font-weight: 600; }
.ws-pop-foot a { color: var(--primary); text-decoration: none; }
.ws-pop-foot a.ws-pop-btn { width: 100%; color: var(--primary-strong); border-color: var(--primary); }
/* The style list scrolls; its "New style" button stays pinned at the bottom. */
.ws-style-pop .ws-pop-foot { position: sticky; bottom: calc(-1 * var(--space-3)); margin: 0 calc(-1 * var(--space-3)) calc(-1 * var(--space-3)); padding: var(--space-2) var(--space-3) var(--space-3); background: var(--surface); }
.ws-pop-foot a.ws-pop-btn:hover { background: var(--primary-soft); }
.ws-options { display: flex; flex-direction: column; }
.ws-format { padding: 8px 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.ws-format:hover { background: var(--ground); }
.ws-format[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.ws-format:disabled { background: none; color: var(--ink-muted); cursor: not-allowed; }
.ws-custom { display: flex; align-items: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.ws-custom label { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; }
.ws-custom input { width: 84px; }
.ws-checks { display: flex; flex-direction: column; gap: 4px; }
.ws-check { display: flex; align-items: center; gap: var(--space-2); padding: 6px; border-radius: var(--radius-md); cursor: pointer; }
.ws-check:hover { background: var(--ground); }
.ws-check img, .ws-check-ph { width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--radius-sm); object-fit: cover; background: var(--ground); display: flex; align-items: center; justify-content: center; }
.ws-check span { display: flex; flex-direction: column; min-width: 0; }
.ws-check small { color: var(--ink-muted); }
.ws-facts { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.ws-facts dt { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.ws-facts dd { margin: 0; }
.ws-engine-pop p { margin: 0; font-size: 0.82rem; }

/* ---- Toolbar ---- */
.ws-main { min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }

/* ---- Feed ---- */
.ws-feed { display: flex; flex-direction: column; gap: var(--space-4); }
.ws-feed-note { margin: var(--space-4) 0; }
.ws-empty { margin: var(--space-10) auto; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; color: var(--ink-muted); }
.ws-empty i { font-size: 2.6rem; color: var(--border-strong); }
.ws-empty strong { color: var(--ink); font-size: 1.05rem; }
.ws-row { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ws-row-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.ws-row-text { flex: 1; min-width: 200px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.ws-row-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--ground); border: 1px solid var(--border); color: var(--ink); font-size: 0.78rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
a.ws-chip:hover { border-color: var(--primary); color: var(--primary-strong); }
.ws-chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }
.ws-time { margin-left: var(--space-2); font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }
.ws-row-images { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ws-row-empty { margin: 0; font-size: 0.9rem; }
.ws-card { margin: 0; display: flex; flex-direction: column; max-width: 100%; min-width: 200px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ws-card-media { --h: 300px; height: var(--h); width: 100%; min-width: calc(var(--h) * var(--ratio, 1)); display: flex; background: var(--ground); }
.ws-card-media .image-hover-actions { z-index: 1; }
.ws-card-media .asset-image-wrap { width: 100%; height: 100%; }
.ws-card-media img.ws-clickable { cursor: pointer; }
.ws-card-media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ws-card-bar { display: flex; align-items: center; gap: 6px; padding: var(--space-2) var(--space-3); flex-wrap: wrap; }
.ws-card-bar .rx-badge { border: 0; font-family: var(--font-sans); cursor: pointer; }
.ws-act { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-md); background: none; color: var(--ink); text-decoration: none; cursor: pointer; }
.ws-act:hover { background: var(--ground); color: var(--primary); }
.ws-act:disabled { opacity: 0.4; cursor: default; }
.ws-small { font-size: 0.8rem; }
.ws-pending { margin: auto; padding: var(--space-4); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; font-size: 0.88rem; }
.ws-card-failed .ws-pending i { font-size: 1.6rem; color: var(--logo-red); }
.ws-error-text { color: var(--ink-muted); font-size: 0.82rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ws-more { display: flex; justify-content: center; }

/* Grid layout: every image in one grid, with its request as a caption. */

/* Details modal */
.modal-dialog.ws-details-modal { max-width: 1100px; }
.ws-details { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.ws-details-media img { display: block; width: 100%; height: auto; max-height: 75vh; object-fit: contain; border-radius: var(--radius-md); background: var(--ground); }
.ws-details-info h2 { margin: 0; font-size: 1.4rem; }
.ws-details-info > p { margin: 0; }
.ws-details-qa { display: flex; flex-direction: column; gap: var(--space-3); }

@media (max-width: 1100px) {
  .ws { grid-template-columns: 1fr; }
  .ws-panel { position: relative; }

  .ws-details { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main-content.as-page.ws-page { padding: var(--space-3); }
  .ws-form { padding: var(--space-4) var(--space-4) 0; }
  .ws-card { width: 100%; }
  .ws-card-media { min-width: 0; height: auto; aspect-ratio: var(--ratio, 1); max-height: 70vh; }
  .ws-row { padding: var(--space-3); }
  .ws-controls { flex-wrap: wrap; }
}
/* Art Studio page header, above the workspace */
.ws-head { display: flex; flex-direction: column; gap: var(--space-2); max-width: 720px; }
.ws-head h1 { margin: 0; font-size: 2.6rem; line-height: 1.1; text-wrap: balance; }
.ws-head p { margin: 0; font-size: 1.06rem; line-height: 1.55; }
@media (max-width: 600px) { .ws-head h1 { font-size: 1.9rem; } }
/* Art Studio: advice on images the quality check did not pass, and the edit flow */
.ws-card-media { position: relative; }
.ws-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-4); text-align: center; font-size: 0.88rem; font-weight: 600; background: rgba(244, 247, 248, 0.86); color: var(--ink); }
.ws-advice { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-top: 1px solid var(--border); background: var(--warn-soft); color: var(--warn-ink); font: 600 0.85rem var(--font-sans); text-align: left; cursor: pointer; }
.ws-advice span { flex: 1; min-width: 0; }
.ws-advice:hover { text-decoration: underline; }
.ws-edit-error { margin: 0; display: flex; gap: 6px; align-items: baseline; padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border); background: var(--danger-soft); color: var(--danger-ink); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-edit-form { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.ws-edit-form h2 { margin: 0; font-size: 1.4rem; }
.ws-edit-form > p { margin: 0; }
.ws-edit-scores { display: flex; flex-direction: column; gap: var(--space-2); }
.ws-edit-scores:empty { display: none; }
.ws-suggestions { margin: 0; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: var(--space-2); }
.ws-suggestions legend { padding: 0 var(--space-1); font-weight: 700; }
.ws-suggestion { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 0.9rem; cursor: pointer; }
.ws-suggestion input { margin-top: 3px; accent-color: var(--primary); }
.ws-edit-own { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.ws-edit-own textarea { width: 100%; resize: vertical; font-weight: 400; }
@media (max-width: 1100px) { .ws-details-media img { max-height: 42vh; } }
.ws-edit-scores > .rx-badge { align-self: flex-start; }
/* Art Studio: previous vs current version after an edit */
.ws-compare { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-top: 1px solid var(--border); font: 600 0.85rem var(--font-sans); text-align: left; cursor: pointer; }
.ws-compare span { flex: 1; min-width: 0; }
.ws-compare.is-better { background: var(--success-soft); color: var(--success); }
.ws-compare.is-worse { background: var(--primary-soft); color: var(--primary-strong); }
.ws-compare:hover span { text-decoration: underline; }
.ws-cmp { display: flex; flex-direction: column; gap: var(--space-4); }
.ws-cmp h2 { margin: 0; font-size: 1.4rem; }
.ws-cmp-summary { margin: 0; display: flex; gap: var(--space-2); align-items: baseline; flex-wrap: wrap; }
/* All versions of an image (comparison window): two at a time, arrows when there are more. */
.ws-car { position: relative; }
.ws-car-track { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - var(--space-4)) / 2); gap: var(--space-4); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ws-car-track::-webkit-scrollbar { display: none; } /* the arrows (and swipe) move it */
.ws-car-item { margin: 0; display: flex; flex-direction: column; gap: var(--space-2); scroll-snap-align: start; min-width: 0; }
.ws-car-media { position: relative; }
.ws-car-media img { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: var(--radius-md); background: var(--ground); border: 1px solid var(--border); }
.ws-car-item.is-compared .ws-car-media img { border-color: var(--border-strong); }
.ws-car-item figcaption { font-weight: 700; font-size: 0.9rem; }
.ws-car-tools { position: absolute; right: var(--space-2); bottom: var(--space-2); display: flex; gap: 6px; }
.ws-car-tool { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border); color: var(--ink); font-size: 0.95rem; text-decoration: none; cursor: pointer; box-shadow: 0 2px 8px rgba(29, 51, 60, 0.15); }
.ws-car-tool:hover { border-color: var(--primary); color: var(--primary); }
.ws-car-nav { position: absolute; top: calc(50% - 30px); z-index: 2; width: 36px; height: 36px; display: none; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--ink); box-shadow: 0 2px 10px rgba(29, 51, 60, 0.18); cursor: pointer; }
.ws-car.has-more .ws-car-nav { display: inline-flex; }
.ws-car-nav.prev { left: -12px; }
.ws-car-nav.next { right: -12px; }
.ws-car-nav:disabled { opacity: 0; pointer-events: none; }
.ws-edit-version { margin: var(--space-2) 0 0; font-weight: 700; font-size: 0.9rem; }
/* Edit window, left column: the image, then your own changes and Apply. */
.ws-edit-left { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.ws-edit-left .ws-edit-version { margin: 0; }
/* The image takes only the height left after the fields below it (~420px:
   label, your own changes, the note, Apply, the window's padding), so the
   whole column always fits in the window. */
.ws-details-media.ws-edit-left img { max-height: max(160px, calc(100vh - 430px)); }
.ws-edit-left > p { margin: 0; }
/* One version at a time (the image details window). */
.ws-car.single .ws-car-track { grid-auto-columns: 100%; }
.ws-car.single .ws-car-media img { max-height: 70vh; }
.ws-car.single .ws-car-nav { top: calc(50% - 30px); }
.ws-car.single .ws-car-nav.prev { left: 8px; }
.ws-car.single .ws-car-nav.next { right: 8px; }
.ws-cmp-table-wrap { overflow-x: auto; }
.ws-cmp-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.ws-cmp-table th, .ws-cmp-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.ws-cmp-table td.is-up { color: var(--success); font-weight: 700; }
.ws-cmp-table td.is-down, .ws-cmp-table td.is-fail { color: var(--logo-red); font-weight: 700; }
@media (max-width: 600px) { .ws-car-track { grid-auto-columns: 100%; } }

/* Style Guides list: delete button at the end of each card's actions */
.sg-delete-btn { margin-left: auto; color: var(--ink-muted); }
.sg-delete-btn:hover { border-color: var(--logo-red); background: var(--danger-soft); color: var(--danger-ink); }
/* Send Email Message (pages/prayer-request-eblast.php). The form is wider
   than the usual .stacked-form, since it holds a full HTML email. */
.eblast-form { max-width: none; }
.eblast-form textarea { font-family: Consolas, "Courier New", monospace; font-size: 0.85rem; }
.eblast-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.eblast-address-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.eblast-address-row input { flex: 1; max-width: 420px; }
.link-button.eblast-add-address { color: var(--navy); text-decoration: none; align-self: flex-start; }
.eblast-section-title { font-size: 1.15rem; margin: 0 0 0.75rem; }
main > .eblast-section-title { margin-top: 1.5rem; }
.eblast-preview {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff; /* emails are designed on white, even in dark mode */
  resize: vertical;
}
.eblast-send-row { margin-top: 1rem; }
button.primary:disabled { opacity: 0.5; cursor: default; }
.eblast-form input[type=url], .eblast-form input[type=date] {
  font-family: inherit;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.eblast-form input[type=date] { max-width: 200px; }
.eblast-test {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}
.eblast-test-row { display: flex; gap: 0.5rem; margin: 0.35rem 0 0.5rem; }
.eblast-test-row input { flex: 1; min-width: 0; }
.eblast-test-btn {
  background: none;
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.eblast-test-btn:hover:not(:disabled) { background: var(--navy); color: #fff; }
.eblast-test-btn:disabled { opacity: 0.5; cursor: default; }
.eblast-test p { margin: 0; }
.eblast-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.eblast-fieldset:disabled { opacity: 0.75; }
.eblast-current { margin: 0; color: var(--muted); font-size: 0.9rem; }
.eblast-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.link-button.eblast-delete { margin-left: auto; }
.eblast-sent-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid #2a7a3d;
  border-radius: 6px;
  background: var(--panel);
  font-size: 0.9rem;
}
.eblast-sent-banner[hidden] { display: none; }
.eblast-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--border);
  color: var(--ink);
}
.eblast-badge--prepared { background: var(--gold); color: #201f3d; }
.eblast-badge--sent { background: #2a7a3d; color: #fff; }
.eblast-badge--partial, .eblast-badge--failed, .eblast-badge--sending { background: var(--red); color: #fff; }
.users-table tr.eblast-row-current td { background: color-mix(in srgb, var(--navy) 8%, transparent); }

/* Stories > Tour Testimonials (pages/testimonials.php, testimonial.php). */
.list-toolbar select { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--ink); }
.tm-table .tm-date { white-space: nowrap; }
.tm-table .tm-text { max-width: 480px; }
.tm-table tr.tm-row-hidden td { opacity: 0.5; }
.tm-visible-toggle .fa-toggle-on { color: var(--navy); }
.tm-visible-toggle .fa-toggle-off { color: var(--muted); }
.tm-form { max-width: none; }
.tm-form input[type=url], .tm-form input[type=date] {
  font-family: inherit; padding: 0.5rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--ink);
}
.stacked-form label.tm-visible { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 600; }
.tm-add-form input[type=url], .tm-add-form input[type=date] {
  font-family: inherit; padding: 0.5rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--ink);
}
.tm-summary { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tm-summary .link-button.tm-show-all { color: var(--navy); }
.tm-screen { font-size: 0.8rem; margin-top: 0.3rem; color: var(--muted); }
.tm-screen-label { font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 999px; margin-right: 0.25rem; }
.tm-screen--ok .tm-screen-label { background: #2a7a3d; color: #fff; }
.tm-screen--rejected .tm-screen-label { background: var(--border); color: var(--ink); }
.tm-table tr.tm-row-hidden td .tm-screen { opacity: 1; }

/* Stories > Social Replies (pages/social-replies.php). */
.sr-card { max-width: 820px; }
.sr-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; }
.sr-head .fa-facebook { color: #1877F2; }
.sr-head .fa-instagram { color: #E1306C; }
.sr-intent, .sr-status { font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; margin-left: 0.3rem; background: var(--border); color: var(--ink); }
.sr-card--todo .sr-status { background: var(--gold); color: #201f3d; }
.sr-card--sent .sr-status { background: #2a7a3d; color: #fff; }
.sr-comment { white-space: pre-wrap; margin: 0.6rem 0 0.3rem; }
.sr-context, .sr-open { margin: 0.2rem 0; font-size: 0.85rem; }
.sr-draft-label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; margin: 0.7rem 0 0.6rem; }
.sr-draft { width: 100%; box-sizing: border-box; }
.sr-sent { margin-top: 0.6rem; padding: 0.6rem 0.8rem; border-left: 3px solid #2a7a3d; background: color-mix(in srgb, #2a7a3d 6%, transparent); }
.sr-sent p { margin: 0.3rem 0 0; white-space: pre-wrap; }
.sr-msg { margin: 0.4rem 0 0; }
